<extend name="Public/base_1" />

<!-- 子導航 -->
<block name="sidebar">
    <include file="sidemenu" />
</block>

<block name="body">
    <!-- 標題欄 -->
    <div class="main-title">
        <h2>查看留言</h2>
    </div>

    <div class="tab-wrap">
        <div class="tab-content" >
            <div id="tab1" class="form-horizontal">
               <style>
table{ width:100%; border-collapse:collapse; font-size:13px; background: #fff; margin-bottom: 10px}
table tr{ width:100%; height:50px;}
table tr td{ border:1px #ccc solid; padding-left:15px;}
.text1{ width:70%; height:50px; border:0; padding-left:10px; line-height:50px;}
.text2{ width:70%; height:90px; border:0; vertical-align:middle; padding:10px; line-height:15px; overflow: hidden; font-size: 12px}
</style>
              <table  id="printContent">

  <tr>
    <td>聯繫人：<input type="text" class="text1" value="{$data.name}"></td>
    <td colspan="2">電話：<input type="text" class="text1" value='{$data.phone}'></td>
  </tr>
  <tr>
    <td colspan="3">郵箱：<input type="text" class="text1" value="{$data.email}"></td>
  </tr>
  <tr>
    <td colspan="3">描述：<textarea class="text2" >{$data.content}</textarea></td>
  </tr>
    <td colspan="3" style="border-top:0;">發表時間：<input type="text" class="text1" value="{$data.time|date='Y-m-d',###}"></td>
  </tr>
  
</table>     

                
                <div class="form-item cf">
                  
                    <a  class="btn btn-danger" data-toggle="modal" data-target="#exampleModal" >轉發</a>
                   <a class="btn btn-warning" href="{:U('Admin/Article/feedback','','')}" role="button">返回</a> 
               </div>
            </div>
        </div>
    </div>

    <div class="page">
        {$_page}
    </div>



<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
    
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="exampleModalLabel">轉發郵件</h4>
      </div>
      <div class="modal-body">
        <form action='{:U("Email/sendemail")}' method="post">
          <div class="form-group">
            <label for="recipient-name" class="control-label">轉發到:</label>
            <input name='email' type="text" class="form-control" id="recipient-name">
          </div>
          <div class="form-group">
            <label for="message-text" class="control-label">內容:</label>
            <textarea name='content' class="form-control" id="message-text" value='{$data.content}'>
            {$data.content}
             
            </textarea>
          </div>
 
      </div>
      <div class="modal-footer">
          <input type="submit" class="btn btn-primary" value="轉發">  
        <button type="button" class="btn btn-default" data-dismiss="modal">關閉</button>
      
      </div>       </form>
    </div>
  </div>
</div>
<script>
$('#exampleModal').on('show.bs.modal', function (event) {
  var button = $(event.relatedTarget) // Button that triggered the modal
  var recipient = button.data('whatever') // Extract info from data-* attributes
  // If necessary, you could initiate an AJAX request here (and then do the updating in a callback).
  // Update the modal's content. We'll use jQuery here, but you could use a data binding library or other methods instead.
  var modal = $(this)
  modal.find('.modal-title').text('轉發郵件')
  modal.find('.modal-body input').val(recipient)
})    
</script>    
</block>